import java.sql.*;

public class JDBCTest {

    static final String JDBC_DRIVER = "com.mysql.jdbc.Driver";
    static final String CONN_URL = "jdbc:mysql://127.0.0.1:3306/sakila?useSSL=false";
    static final String USER = "root";
    static final String PASS = "123456";

    public static void main(String[] args) {

        Connection connection = null;
        Statement statement = null;

        try {
            Class.forName(JDBC_DRIVER);
            System.out.println("connection to ....");

            connection = DriverManager.getConnection(CONN_URL, USER, PASS);
            System.out.println("create statement。。。");
            statement = connection.createStatement();
            String sql = "SELECT * FROM sakila.actor;";
            ResultSet resultSet = statement.executeQuery(sql);
            while (resultSet.next()) {
                String actorId = resultSet.getString("actor_id");
                String lastUpdate = resultSet.getString("last_update");
                System.out.println(actorId + "\t\t" + lastUpdate);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

}
